# $OpenBSD: httpd.conf,v 1.14 2015/02/04 08:39:35 florian Exp $

#
# Macros
#
ext_addr="*"

#
# Global Options
#
# prefork 3

#
# Servers
#

# A minimal default server
server "default" {
	listen on $ext_addr port 80
}

# A name-based "virtual" server on the same address
server "www.example.com" {
	listen on $ext_addr port 80

	# Logging is enabled by default, but it can be turned off per server
	#no log

	location "/pub/*" {
		directory auto index
		log style combined
	}

	location "*.php" {
		fastcgi socket "/run/php-fpm.sock"
	}

	location "/cgi-bin/*" {
		fastcgi

		# The /cgi-bin directory is outside of the document root
		root "/"
	}

	root "/htdocs/www.example.com"
}

# An HTTPS server using SSL/TLS
server "secure.example.com" {
	listen on 127.0.0.1 tls port 443

	# Define server-specific log files relative to /logs
	log { access "secure-access.log", error "secure-error.log" }

	# Increase connection limits to extend the lifetime
	connection { max requests 500, timeout 3600 }

	root "/htdocs/secure.example.com"
}

# Another server on a different internal IPv4 address
server "intranet.example.com" {
	listen on 10.0.0.1 port 80
	directory { auto index, index "default.htm" }
	root "/htdocs/intranet.example.com"
}

# An IPv6-based server on a non-standard port
server "ipv6.example.com" {
	listen on 2001:db8::53f6:3eab port 81
	root "/htdocs/ipv6.example.com"
}

# Include MIME types instead of the built-in ones
types {
	include "/usr/share/misc/mime.types"
}
